﻿// CAnimation.cs
// Author: Gant Briseno
#region Using Statements
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#endregion

namespace Casters.source.Animation
{
    /// <summary>
    /// A collection of frames to be used for rendering
    /// </summary>
    public class CAnimation
    {
        public string m_Name;
        public bool m_bIsDonePlaying;
        public bool m_bIsLooping;
        public bool m_bHasAttacked;
        public List<CFrame> m_FrameList = new List<CFrame>();
        public int m_FrameCount;

        /// <summary>
        /// Finds the Width of said frame
        /// </summary>
        /// <param name="frame">The specified frame</param>
        /// <returns>Frame's Width</returns>
        public int FrameWidth(int frame)
        {
            return m_FrameList[frame].m_ImageRect.Width;
        }

        /// <summary>
        /// Finds the Height of said frame
        /// </summary>
        /// <param name="frame">The specified frame</param>
        /// <returns>Frame's Height</returns>
        public int FrameHeight(int frame)
        {
            return m_FrameList[frame].m_ImageRect.Height;
        }

        /// <summary>
        /// For debugging
        /// </summary>
        public override string ToString()
        {
            string temp = "";
            switch (m_Name)
            {
                default:
                    temp = "default";
                    break;
            }

            return temp;
        }

        /// <summary>
        /// Constructor
        /// </summary>
        public CAnimation(string name, int frameCount, bool isLooping, List<CFrame> frames)
        {
            m_FrameCount = frameCount;
            m_bIsLooping = isLooping;
            m_FrameList = frames;
            m_Name = name;
        }

        /// <summary>
        /// Constructor
        /// </summary>
        public CAnimation(string name, int frameCount, bool isLooping, CFrame[] frames)
        {
            m_FrameCount = frameCount;
            m_bIsLooping = isLooping;
            m_Name = name;

            foreach(CFrame frame in frames)
                m_FrameList.Add(frame);
        }
    }
}
